package com.lxk.util;

import com.google.common.base.CaseFormat;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @author JohnSoybean
 * @create 2020/6/16 14:23
 * @description 类型条件判断工具
 */
public class TermUtil {

    /**
     * Long类型 NOT NULL && > 0
     * @param param
     * @return
     */
    public static boolean validLong(Long param) {
        if (param == null || param <= 0) {
            return false;
        } else {
            return true;
        }
    }

    /**
     * Integer类型 NOT NULL && > 0
     * @param param
     * @return
     */
    public static boolean validInteger(Integer param) {
        if (param == null) {
            return false;
        } else {
            return true;
        }
    }

    /**
     * String类型 NOT NULL && 不为空或纯空格
     * @param param
     * @return
     */
    public static boolean validString(String param) {
        if (param == null || param.trim().isEmpty()) {
            return false;
        } else {
            return true;
        }
    }

    /**
     * 排序 int转为 boolean
     * @param param
     * @return
     */
    public static boolean isAsc(Integer param) {
        if (param == null) {
            return true;
        }
        if (param == -1) {
            return false;
        } else {
            return true;
        }
    }


    public static String toCamel(String param) {
        System.out.println(param);
        if (validString(param)) {
            return CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, param);
        }
        return null;
    }

    public static void main(String[] args) {
        String s = CodeUtil.generateUUIDCode();
        System.out.println(s);
    }

}
